<?php
include ('getaccesstoken.php');
$access_token = getaccesstoken();
$menupostdata = '{
  				  "button":[
					  {	
						   "type":"click",
						   "name":"今日歌曲",
						   "key":"V1001_TODAY_MUSIC"
					   },
					   {
						    "type":"click",
						    "name":"歌手简介",
						    "key":"V1001_TODAY_SINGER"
					   },
					   {
						    "name":"菜单",
						    "sub_button":[
							 {
							    "type":"click",
							    "name":"hello word",
							    "key":"V1001_HELLO_WORLD"
						 	 },
							 {
							    "type":"click",
							    "name":"赞一下我们",
							    "key":"V1001_GOOD"
							 }]
					    }]
				  }';
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$access_token;
$ch = curl_init();
curl_setopt( $ch , CURLOPT_URL , $url);
curl_setopt( $ch , CURLOPT_SSL_VERIFYPEER , FALSE );
curl_setopt( $ch , CURLOPT_SSL_VERIFYHOST , FALSE );
curl_setopt( $ch , CURLOPT_POST , 1 );
curl_setopt( $ch , CURLOPT_POSTFIELDS , $menupostdata );
$content=curl_exec($ch);
curl_close($ch);
$jsoninfo=json_decode($content,true);
if($jsoninfo['errcode']==0)
	{
		echo "创建菜单成功";
	}
else
	{
    	echo "创建菜单失败";
	}	
?>